package com.lanhu.designpattern.template;

/**
 * @author 蓝狐
 */
public abstract class IBaseService {

    /**
     * 创建对象
     * @param object
     */
    public void create(Object object){
        //创建之前可以做验证等操作
        beforeCreate(object);
        //验证完成后可以直接入库
        insertDatabase(object);
        //入库后做其他操作
        afterCreate(object);
    }

    /**
     * 更新对象
     * @param object
     */
    public void update(Object object){
        //更新之前做一些操作
        beforeUpdate(object);
        //更新数据库操作
        updateDatabase(object);
        //更新之后做一些操作
        afterUpdate(object);
    }

    protected  void afterUpdate (Object object){};

    protected  void updateDatabase (Object object){};

    protected  void beforeUpdate (Object object){};

    protected  void afterCreate (Object object){};

    protected  void insertDatabase (Object object){};

    protected  void beforeCreate (Object object){};
}
